package com.bafa.front.presentationbeans;

import java.util.TreeSet;

import com.bafa.objects.Match;
import com.bafa.objects.player.PlayerMatch;
import com.bafa.services.RetrieveServices;

public class PlayerListBean {

	private TreeSet players = new TreeSet();

	/**
	 * Used to display list of top scorers for a division for a season
	 * @param scorers
	 * @param seasonId
	 * @param divisionId
	 */
	public PlayerListBean(String[] scorers,int seasonId,int divisionId) {
		for(int i=0;i<scorers.length;i++){
			players.add(new PlayerBean(RetrieveServices.getPlayer(scorers[i]),seasonId,divisionId));
		}
	}
	
	/**
	 * Used to display list of top scorers for a division for a season
	 * @param scorers
	 * @param seasonId
	 * @param divisionId
	 */
	public PlayerListBean(String[] scorers,int seasonId,int divisionId,boolean make) {
		for(int i=0;i<scorers.length;i++){
			players.add(new PlayerBean(RetrieveServices.getPlayer(scorers[i]),seasonId,divisionId,make));
		}
	}
	
	
	public PlayerListBean(String[] scorers) {
		
		for(int i=0;i<scorers.length;i++){
			players.add(new PlayerBean(RetrieveServices.getPlayer(scorers[i])));
		}
	}
	public PlayerListBean(String[] scorers,int teamId) {
		for(int i=0;i<scorers.length;i++){
			players.add(new PlayerBean(RetrieveServices.getPlayer(scorers[i]),teamId));
		}
	}
	public PlayerListBean(String[] scorers,Match match) {
		for(int i=0;i<scorers.length;i++){
			
			PlayerMatch playerMatch = RetrieveServices.getPlayer(scorers[i]).getMatchGoals().get(match.getID());
			
			players.add(new PlayerBean(playerMatch,scorers[i]));
		}
	}
	
	public PlayerBean[] players(){
		return (PlayerBean[])players.toArray(new PlayerBean[players.size()]);
	}
	public TreeSet getPlayers() {
		return players;
	}

	public void setPlayers(TreeSet players) {
		this.players = players;
	}
	
}
